package com.littlebee.storysuper.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.littlebee.storysuper.R;
import com.littlebee.storysuper.entry.User;
import com.littlebee.storysuper.utils.Utils;
import com.zss.library.activity.BaseActivity;
import com.zss.library.toolbar.CommonToolbar;

import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.model.UserInfo;

/**
 * 个人中心
 */
public class MeActivity extends BaseActivity implements View.OnClickListener{
    TextView logOutTv;

    @Override
    public int getLayoutResId() {
        return R.layout.activity_me;
    }

    @Override
    public void initView() {
        super.initView();
        logOutTv=(TextView)findViewById(R.id.logout_tv);
        logOutTv.setOnClickListener(this);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
    }

    @Override
    public void setTopBar() {
        super.setTopBar();
        setStatusBarColor(R.color.module_video_bg);

        CommonToolbar toolbar = getToolbar();
        toolbar.setBgRes(R.color.module_video_bg);
        toolbar.setTitle(getString(R.string.me_info_txt));

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.logout_tv:
                // TODO: 2017/8/15
                UserInfo myInfo = JMessageClient.getMyInfo();
                if (myInfo != null) {
                    JMessageClient.logout();

                }
                Utils.saveUserEntry(null);
                finish();
                break;
        }

    }
}
